﻿<%@ Page Title="" Language="C#" MasterPageFile="~/SIPO.master" AutoEventWireup="true" CodeFile="rptInvoicelist.aspx.cs" Inherits="SIPO.Web.lists.Report.rptInvoicelist" %>

<asp:Content ID="Content1" ContentPlaceHolderID="body" Runat="Server">

<script src="<%= ResolveUrl("~/scripts/jquery.validate.min.js") %>" type="text/javascript"></script>
<script src="<%= ResolveUrl("~/scripts/jquery.validate.wrapper.js") %>" type="text/javascript"></script>
<link href="<%= ResolveUrl("~/styles/jquery.validate.error.css") %>" rel="stylesheet" type="text/css" />
<script src="<%= ResolveUrl("~/scripts/jquery-ui.min.js") %>" type="text/javascript"></script>

    <script type="text/javascript">
        $(document).ready(function () {

            $("#<%= txtPeriodeAwal.ClientID %>").attr('disabled', 'disabled');
            $("#<%= txtPeriodeAkhir.ClientID %>").attr('disabled', 'disabled');
            $("#<%= ddlDebitur.ClientID %>").attr('disabled', 'disabled');
            $("#<%= txtPeriodeAwal.ClientID %>").val('Periode Awal ');
            $("#<%= txtPeriodeAkhir.ClientID %>").val('Periode Akhir');
            $("#<%= ddlDebitur.ClientID %>").val('-- pilih Perusahaan --');

            // format tanggal  datetimepicker
            $("#<%= txtPeriodeAwal.ClientID  %>").datepicker({ showWeek: true, showButtonPanel: true,
                changeMonth: true, changeYear: true, dateFormat: 'dd/mm/yy',
                numberOfMonths: 1,
                onSelect: function (selected) {
                    $("#<%= txtPeriodeAkhir.ClientID %>").datepicker("option", "minDate", selected)
                }
            });

            $("#<%= txtPeriodeAkhir.ClientID  %>").datepicker({ showWeek: true, showButtonPanel: true,
                changeMonth: true, changeYear: true, dateFormat: 'dd/mm/yy',
                numberOfMonths: 1,
                onSelect: function (selected) {
                    $("#<%= txtPeriodeAwal.ClientID %>").datepicker("option", "maxDate", selected)
                }
            });

            //radio button periode awal dan periode akhir
            $("#<%= rbPeriode1.ClientID %>").click(function () {
                $("#<%= txtPeriodeAwal.ClientID %>").removeAttr('disabled');
                $("#<%= txtPeriodeAkhir.ClientID %>").removeAttr('disabled');
                $("#<%= txtPeriodeAwal.ClientID %>").val('');
                $("#<%= txtPeriodeAkhir.ClientID %>").val('');
            });

            $("#<%= rbPeriode2.ClientID %>").click(function () {
                $("#<%= txtPeriodeAwal.ClientID %>").attr('disabled', 'disabled');
                $("#<%= txtPeriodeAkhir.ClientID %>").attr('disabled', 'disabled');
                $("#<%= txtPeriodeAwal.ClientID %>").val('Periode Awal');
                $("#<%= txtPeriodeAkhir.ClientID %>").val('Periode Akhir');
            });

            //radio button periode debitur
            $("#<%= rbDebitur1.ClientID %>").click(function () {
                $("#<%= ddlDebitur.ClientID %>").removeAttr('disabled');
            });

            $("#<%= rbDebitur2.ClientID %>").click(function () {
                $("#<%= ddlDebitur.ClientID %>").attr('disabled', 'disabled');
                $("#<%= ddlDebitur.ClientID %>").val('-- pilih Perusahaan --');
            });

            //radio button invoice 
            $("#<%= rbInvoice1.ClientID %>").click(function () {
                $("#<%= rbInvoice2.ClientID %>").attr('checked', false);
            });

            $("#<%= rbInvoice2.ClientID %>").click(function () {
                $("#<%= rbInvoice1.ClientID %>").attr('checked', false);
            });

            $("#btnNext").click(function () {
                var periodeAwal = $("#<%= txtPeriodeAwal.ClientID %>").val();
                var periodeAkhir = $("#<%= txtPeriodeAkhir.ClientID %>").val();

                if ($("#<%= txtPeriodeAwal.ClientID %>").is(':disabled'))
                    periodeAwal = "";
                else
                    periodeAwal = $("#<%= txtPeriodeAwal.ClientID %>").val();

                if ($("#<%= txtPeriodeAkhir.ClientID %>").is(':disabled'))
                    periodeAkhir = "";
                else
                    periodeAkhir = $("#<%= txtPeriodeAkhir.ClientID %>").val();


                var debtorID = $("#<%= ddlDebitur.ClientID %>").val();

                window.location = "rptInvoicelist.aspx?periodeAwal=" + periodeAwal + "&periodeAkhir=" + periodeAkhir + "&debtorID=" + debtorID;
                
            });
        });
    </script>
    <table border="0">
        <tr>
            <td style="width: 50; text-align: left; ">
                        Periode
                    </td>
            <td>
                        :</td>
            <td>
                <asp:RadioButton ID="rbPeriode1" runat="server" GroupName="rbPeriode" />
                <asp:TextBox ID="txtPeriodeAwal" runat="server" Width="150"></asp:TextBox>
                s/d
                        <asp:TextBox ID="txtPeriodeAkhir" runat="server" Width="150"></asp:TextBox>
                
                <br />
            </td>
        </tr>
        <tr>
            <td style="width: 50; text-align: left; height: 15px;">
                        </td>
            <td style="height: 15px">
                        </td>
            <td style="height: 15px">
                <asp:RadioButton ID="rbPeriode2" runat="server" GroupName="rbPeriode" 
                    Text="Semua" Checked="True" />
            </td>
        </tr>
        <tr>
            <td style="width: 50; ">
                Perusahaan</td>
            <td>
                        :
                    </td>
            <td>
                <asp:RadioButton ID="rbDebitur1" runat="server" GroupName="rbDebitur" />
                <asp:DropDownList ID="ddlDebitur" runat="server" Width="200">
                </asp:DropDownList>
                <br />
            </td>
        </tr>
        <tr>
            <td style="width: 50">
                &nbsp;</td>
            <td>
                        &nbsp;</td>
            <td>
                <asp:RadioButton ID="rbDebitur2" runat="server" GroupName="rbDebitur" 
                    Text="Semua" Checked="True" />
            </td>
        </tr>
        <tr>
            <td style="width: 50; height: 15px; color: #FFFFFF;">
                Jenis Invoicee</td>
            <td style="height: 15px; color: #FFFFFF;">
                        :
                    </td>
            <td style="height: 15px">
                <asp:RadioButton ID="rbInvoice1" runat="server" GroupName="rbInvoice1" 
                    Text="Void" Enabled="False" Visible="False"/>
                <br />
            </td>
        </tr>
        <tr>
            <td style="width: 50; height: 9px;">
            </td>
            <td style="height: 9px">
            </td>
            <td>
                <asp:RadioButton ID="rbInvoice2" runat="server" GroupName="rbInvoice2" 
                    Text="Semua" Checked="True" Enabled="False" Visible="False" />
            </td>
        </tr>
        <tr>
            <td colspan="2">
                &nbsp;
            </td>
            <td>
                <div style="text-align: right; padding-top: 10px;">
                    <button class="dialog_link ui-state-default ui-corner-all" id="btnNext" type="button">
                        Lanjut
                    </button>
                    <button class="dialog_link ui-state-default ui-corner-all" id="btnCancel" type="button">
                        Batal
                    </button>
                </div>
            </td>
        </tr>
    </table>
    <div>
        <asp:ScriptManager ID="scManager" runat="server" EnablePartialRendering="true">
        </asp:ScriptManager>
        <rsweb:ReportViewer  ID="rsViewer" runat="server" Height="100%" Width="100%">
        </rsweb:ReportViewer>
    </div>
</asp:Content>

